Figure 12.10
A figure scaled by a factor of two in the X direction.
Reflection
By reflecting an object across the X or Y axis, you can create a mirror image of the object. Figure 12.11 shows an object and its reflection across the Y axis.
Reflecting an object across an axis is equivalent to scaling it with a negative scale factor. For instance, to reflect an object across the Y axis as shown in Figure 12.11, you can scale the object by a factor of 1 in the X direction. You can write the new coordinates of a point as:
new_x = old_x * (1)
new_y = old_y
You can reflect an object across the X axis similarly by scaling it by a factor of 1 in the Y direction.
new_x = old_x
new_y = old_y * (1)
Rotation
Rotating an object is a little trickier than translating or scaling one. The equations for rotating a point around the origin by an angle q are: